- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
I'm dealing with Speech compression using CELP.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mert Sari
el 15 de En. de 2024
Comentada: Stephen23
el 15 de En. de 2024
I implemented the code I got from this link https://www.mathworks.com/matlabcentral/fileexchange/39038-celp-codec. There were a few errors but I resolved them. My only problem is that after running the code, it does not play the audio file. I want to watch the original first and then the encoded audio file. What should I do?
0 comentarios
Respuesta aceptada
Hassaan
el 15 de En. de 2024
Editada: Hassaan
el 15 de En. de 2024
% Read the original audio file
[originalAudio, fs] = audioread('path_to_your_original_audio_file.wav');
% Play the original audio file
sound(originalAudio, fs);
pause(length(originalAudio)/fs); % Wait for the original to finish
% Assuming you have the CELP encoding and decoding functions
encodedAudio = celp_encode(originalAudio, fs); % This function should encode the audio
decodedAudio = celp_decode(encodedAudio, fs); % This function should decode the audio
% Play the encoded and then decoded audio file
sound(decodedAudio, fs);
% Wait for the decoded to finish, if necessary
% pause(length(decodedAudio)/fs); % Uncomment if needed
% If you do not want to wait for the entire audio to play before moving on with the code,
% you can use the audioplayer function to have more control over playback:
% player = audioplayer(decodedAudio, fs); % Uncomment if needed
% play(player); % This plays the sound asynchronously. Uncomment if needed
Make sure to replace `'path_to_your_original_audio_file.wav'` with the actual path to your audio file. If `celp_encode` and `celp_decode` are not the actual names of the functions used for encoding and decoding in the CELP codec you implemented, replace them with the correct function names.
If the playback doesn't start or you encounter errors, ensure that:
- Your audio device is functioning correctly.
- MATLAB's volume is not muted or too low.
- The encoded and decoded audio data is in the correct format for playback.
Also, be aware that the `sound` function immediately starts playback in MATLAB and will block until it's complete, hence the use of `pause`. The `audioplayer` function, on the other hand, allows for asynchronous playback control.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
Feel free to contact me.
4 comentarios
Stephen23
el 15 de En. de 2024
"I mean to say it blocks and once the playback completes then it continues the below statements."
That is incorrect.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!