IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Interfaces Graphiques Discussion :

appeler un boutton


Sujet :

Interfaces Graphiques

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Inscrit en
    Mars 2009
    Messages
    92
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 92
    Par défaut appeler un boutton
    salut
    j'ai une interface qui fait l'enregistrement du son et j'ai 4 bouuton un pour l'enregistrement du son et un pour écouté le son enregistrer et un pour quitter la figure.
    j'ai programmer le premier boutton qui fait l'enregistrement mais j'aarive pas a l'écouté malgré que j'ai fait un callback dans le deuxiéme boutton qui contient wavplay(y,fs);
    j'ésépre qu'il ya quelqu'un qui peux m'aidé
    merci

  2. #2
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    Peux-tu nous fournir ce que tu as code dans le 2 pushbuttons pour qu'on puisse t'aider?

    Amicalment,

    Michel

  3. #3
    Membre actif
    Inscrit en
    Mars 2009
    Messages
    92
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 92
    Par défaut
    oui sans probléme
    j'ai le premier boutton enregistrer qu'il a ce cose

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    fs=44100;
    y = wavrecord(2*fs,fs,'single');
    et un deuxiemme boutton ecouter qu'il a ce code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    % --- Executes on button press in pushbutton2.
    function pushbutton2_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    wavplay(y,fs);

  4. #4
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    Extrait de la documentation de la fonction wavplay:

    Y must contain audio samples stored in double, int16, or uint8
    matrices. Double precision data samples must be in the range
    -1.0 <= y <= 1.0; values outside that range are clipped.
    Amicalment,

    Michel

  5. #5
    Membre actif
    Inscrit en
    Mars 2009
    Messages
    92
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 92
    Par défaut
    quand j'ai executé le code il me donne cette erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ??? Undefined function or variable 'y'.
     
    Error in ==> enregistrement>pushbutton2_Callback at 89
    wavplay(y,fs);
     
    Error in ==> gui_mainfcn at 75
            feval(varargin{:});
     
    Error in ==> enregistrement at 42
        gui_mainfcn(gui_State, varargin{:});
     
    ??? Error using ==> enregistrement('pushbutton2_Callback',gcbo,[],guidata(gcbo))
    Undefined function or variable 'y'.
     
    ??? Error while evaluating uicontrol Callback
    stp si tu peut m'aidé c'est trés urgent

  6. #6
    Expert confirmé
    Avatar de Caro-Line
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    9 458
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 9 458
    Par défaut
    Les variables ne sont connues que dans la fonction où elles sont définies.
    Il faut que tu trouves un moyen de passer les variables entre les 2 fonctions.
    Il y a déjà plein de messages sur ce sujet et c'est clairement expliqué à la fois dans la FAQ et dans les tutoriels.

    Voir par exemple : afficher des courbes sur un seul "axes" d'une interface utilisateur

  7. #7
    Membre actif
    Inscrit en
    Mars 2009
    Messages
    92
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 92
    Par défaut
    salut
    désolé pour le dérangement mais j'arrive pas a réglé mon probléme puisque je suis encors débutant en matlab
    voila le premier boutton ça marche qui fais l'enregistrement et tout mais le deuxiéme qui me permet d'écouté ce que j'ai enregistré ne fonctionne plus voila mon code et j'éspére qu'il ya quelqu'un qui peux m'aidé.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    function varargout = enregistrement(varargin)
    % ENREGISTREMENT M-file for enregistrement.fig
    %      ENREGISTREMENT, by itself, creates a new ENREGISTREMENT or raises the existing
    %      singleton*.
    %
    %      H = ENREGISTREMENT returns the handle to a new ENREGISTREMENT or the handle to
    %      the existing singleton*.
    %
    %      ENREGISTREMENT('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in ENREGISTREMENT.M with the given input arguments.
    %
    %      ENREGISTREMENT('Property','Value',...) creates a new ENREGISTREMENT or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before enregistrement_OpeningFunction gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to enregistrement_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help enregistrement
     
    % Last Modified by GUIDE v2.5 05-Jun-2009 09:17:20
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @enregistrement_OpeningFcn, ...
                       'gui_OutputFcn',  @enregistrement_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before enregistrement is made visible.
    function enregistrement_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to enregistrement (see VARARGIN)
     
    % Choose default command line output for enregistrement
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes enregistrement wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = enregistrement_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Get default command line output from handles structure
    varargout{1} = handles.output;
     
     
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    fs = 44100;
    parole = wavrecord(1*fs,fs,'single');
    wavwrite(parole,'voix.wav');
     
     
    % --- Executes on button press in pushbutton2.
    function pushbutton2_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    %y = wavread('voix.wav');
    %wavplay('y',44100);
    h=wavread('C:\Documents and Settings\rezigue\Bureau\application\matlab\voix.wav'); 
    z=audioplayer(h,44100); 
    play(z)
    % --- Executes on button press in pushbutton3.
    function pushbutton3_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
     
    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton4 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)

  8. #8
    Expert confirmé
    Avatar de Caro-Line
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    9 458
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 9 458
    Par défaut
    Citation Envoyé par fcboumi13 Voir le message
    voila le premier boutton ça marche qui fais l'enregistrement et tout mais le deuxiéme qui me permet d'écouté ce que j'ai enregistré ne fonctionne plus
    C'est-à-dire ?
    Message d'erreur ?

  9. #9
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    J'ai teste son application caro il n'y a pas message d'erreur mais son application ne fais rien:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
     
    function varargout = enregistrement(varargin)
    % ENREGISTREMENT M-file for enregistrement.fig
    %      ENREGISTREMENT, by itself, creates a new ENREGISTREMENT or raises the existing
    %      singleton*.
    %
    %      H = ENREGISTREMENT returns the handle to a new ENREGISTREMENT or the handle to
    %      the existing singleton*.
    %
    %      ENREGISTREMENT('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in ENREGISTREMENT.M with the given input arguments.
    %
    %      ENREGISTREMENT('Property','Value',...) creates a new ENREGISTREMENT or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before enregistrement_OpeningFunction gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to enregistrement_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help enregistrement
     
    % Last Modified by GUIDE v2.5 08-Jun-2009 16:08:15
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @enregistrement_OpeningFcn, ...
                       'gui_OutputFcn',  @enregistrement_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before enregistrement is made visible.
    function enregistrement_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to enregistrement (see VARARGIN)
     
    % Choose default command line output for enregistrement
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes enregistrement wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = enregistrement_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Get default command line output from handles structure
    varargout{1} = handles.output;
     
     
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    fs = 44100;
    parole = wavrecord(1*fs,fs,'single');
    wavwrite(parole,'sound1.wav');
     
     
    % --- Executes on button press in pushbutton2.
    function pushbutton2_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    h=wavread('C:\MATLAB71\work\sound1.wav'); 
    z=audioplayer(h,44100); 
    play(z)
     
     
    % --- Executes on button press in pushbutton3.
    function pushbutton3_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
     
    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton4 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    Donc boutton1 c'est pour enregistre, boutton2 pour ecouter tu peux nous dire aussi les autres 2 bouttons qu'est-ce que tu veux faire avec eux?

    Ici c'est ton interface de ce que j'ai compris!

    http://img196.imageshack.us/img196/6/imagel.png

    Et sound1.wav c'est un son avec moi que j'ai enregistre avec sound recorder!

    Ici j'attache le sound1.wav que j'ai adapte a ton code!

    Le probleme est que tu n'as pas d'erreurs sur les premiers 2 bouttons mais quand tu presse les boutton il ne fait rien


    Regarde la discussion d'ici:

    http://www.developpez.net/forums/d75...artir-boutton/

    Donne nous des informations sur les quatres bouttons chaque boutton que tu desires faire...tu as donne peu des details!


    Tu as 3 ou 4 bouttons je n'ai pas compris ca:

    j'ai une interface qui fait l'enregistrement du son et j'ai 4 bouuton un pour l'enregistrement du son et un pour écouté le son enregistrer et un pour quitter la figure.
    Tu as l'archive attache sur flyupload avec le son enregistre!

    J'attends ton reponse!

Discussions similaires

  1. Macro boutton - Appel d'une fonction sur différentes feuilles
    Par tibss dans le forum Macros et VBA Excel
    Réponses: 9
    Dernier message: 16/11/2010, 09h26
  2. Réponses: 0
    Dernier message: 16/04/2008, 09h13
  3. appel de fonction avec boutton
    Par zemeilleurofgreg dans le forum ASP
    Réponses: 8
    Dernier message: 10/09/2007, 16h51
  4. Réponses: 1
    Dernier message: 30/01/2007, 09h19
  5. [VBA] Excel : Appel de fonction au clique sur un boutton
    Par nanu dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 30/09/2006, 19h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo