Using soundsc on Octave, on Windows 7

Well, it's hard for me to start with this. I am trying to use the soundsc function in Octave, but I keep getting this error:

error: sound.m: No command line utility found for sound playing

I searched around for some on the net, but couldn't find out what to do. Here is a link to the source code of a file that I found on the network that contains an error: http://octave-audio.sourcearchive.com/documentation/1.1.3/sound_8m-source.html

The error I think comes from here:

  ## What do we use for playing?
  global sound_play_utility;
  if ~isempty(sound_play_utility),
    ## User specified command
  elseif  (file_in_path(EXEC_PATH, "ofsndplay"))
    ## Mac
    sound_play_utility = "ofsndplay -"
  elseif (file_in_path(EXEC_PATH, "play"))
    ## Linux (sox)
    sound_play_utility = "play -t AU -";
  else
    error("sound.m: No command line utility found for sound playing");
  endif

I just use Windows 7, so I think I need to specify the path somehow myself? Change the source code? I have no idea what I can do to make this work! Can anyone tell me?

+3
source share
4 answers

, :

## This function writes the audio data through a pipe to the program
## "play" from the sox distribution.

, sox. play.exe. sound_play_utility Octave, , sox, , file_in_path(EXEC_PATH) play.exe. , , , popen, . Octave Windows, .

+3

, Windows 7, , soundsc, sox , Windows XP: , ​​,

  • sox Win32: http://sox.sourceforge.net/
  • , sox (, C:\sox-14-3-1), "sox.exe" "play". : ".exe"! , , .
  • start Octave --exec- C:\sox-14-3-1 ( , sox). ( qtoctave , "Octave" " Octave" ).

"play" .

, ; -)

% Sampling theorem - mirror frequency
% s3s11_1.m * mw * 11/17/2007
FS = 8000;    % sampling frequency in Hz
t = 0:1/FS:1; % normalized time
x = [];
for k = 1:7
x  = [x sin(2*pi*k*1e3*t)]; % signal 1...7 kHz
end
soundsc(x,FS) % sound

, : -).

+6

, , . Octave , ​​ sound_play_utility , . , Windows (mplayer, foobar, Winamp, ).

, , , .

+1
source

I do not think that all audio players will work. They should be able to play AU files through the pipe before standard input. Here are the Octave commands that I use to enable the game through VLC. You may need to configure the path to the VLC program in a variable VLC_PROGRAM.

VLC_PROGRAM="c:/Program Files (x86)/VideoLan/VLC/vlc";
VLC_OPTIONS="-q --play-and-exit -";    
sound_play_utility=["cmd /c \"" VLC_PROGRAM "\" " VLC_OPTIONS];    
clear VLC_PROGRAM VLC_OPTIONS;

I recommend placing these commands in a .octavercstartup file so that your sound player automatically tunes every time you start Octave.

+1
source

Source: https://habr.com/ru/post/1765917/


All Articles