In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Octave in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Octave is an open source software for numerical calculation and drawing. Like Matlab, Octave is particularly good at matrix operations: solving simultaneous equations, calculating matrix eigenvalues and Eigenvectors, and so on.
Environmental preparation
First install octave, run the following command on the Ubuntu terminal to add Octave PPA, and then install Octave.
Sudo apt-add-repository ppa:octave/stablesudo apt-get updatesudo apt-get install octave step 1: open Octave
In this step, we click the software icon to open Octave, and we can select the work path by clicking the drop-down button.
Use Octave audio processing (1): read and write files using Octave audio processing (1): read and write files step 2: audio information
Use the audioinfo command to view information about the audio file you want to process.
> info = audioinfo ('testing.ogg') use Octave audio processing (1): read and write files using Octave audio processing (1): read and write files step 3: read audio files
In this tutorial, I will use the ogg file to read the properties of this file, such as sampling, audio type (stereo and mono), number of channels, and so on. It is important to declare that all commands used in the tutorial are executed in the Octave terminal window. First, we have to assign the ogg file to a variable. Note: the file must be in the working path of Octave.
> > file='yourfile.ogg' > > [M, fs] = audioread (file)
Where M is an one-column or two-column matrix, depending on the number of channels, fs is the sampling rate.
You can read the audio file by doing the following:
> [y, fs] = audioread (filename, samples) > > [y, fs] = audioread (filename, datatype) > > [y, fs] = audioread (filename, samples, datatype)
Samples specifies the start and end frames, and datatype specifies the type of data to be returned. You can set values for all variables:
> > samples = [1, fs) > > [y, fs] = audioread (filename, samples)
Data type:
> > [YJEONFs] = audioread (filename,'native')
If the value is "native", its data type depends on how the data is stored in the audio file.
Step 4: write operation of audio file
Create a new ogg file:
We will create an ogg file from a cosine. The sampling rate is 44100 times per second, and this file is sampled for at least 10 seconds. The frequency of the cosine signal is 440 Hz.
> > filename='cosine.ogg'; > > fs=44100; > > tacti0VlGULTHANG FSPLO10; > > wimp2The pirates 440ft; > > signal=cos (w); > > audiowrite (filename, signal, fs)
This creates a 'cosine.ogg' file in the work path, which contains cosine signals.
Use Octave audio processing (1): read and write files using Octave audio processing (1): read and write files
Playing the 'cosine.ogg' file' will produce a 440Hz tone, which happens to be the'A 'tone in music theory. If you need to see the values saved in the file, you must use the 'audioread' function to read the file. In subsequent tutorials, we will see how to read an audio file in two channels.
Step 5: play the audio file
Octave has a default audio player that you can test with. Use the following function:
> > [yjingfs] = audioread ('yourfile.ogg'); > player=audioplayer (yjingfs, 8) scalar structure containing the fields: BitsPerSample = 8 CurrentSample = 0 DeviceID =-1 NumberOfChannels = 1 Running = off SampleRate = 44100 TotalSamples = 236473 Tag = Type = audioplayer UserData = [] (0x0) > play (player) This is the end of this article on "how to use Octave in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.