Tuesday, June 9, 2015
Sunday, June 7, 2015
lmms5. Envelope Settings of the Triple Oscillator
One of the instruments in LMMS is the Triple Oscillator. It is composed of three audio sources such as 3 sine waves. In the default mode (MIX), the output is just the sum.
You can select the Triple Oscillator from the Instrument plugins, near the My Samples button. A list of instruments will appear and you can drag the Triple Oscillator to the Beat + Bassline Editor. You can remove the Kicker instrument from the Editor if you want.
This is the pattern selected:
By playing it, you will notice the master is clipping often as seen by the reddish colors. By exporting the wav file, you can verify the clipping in Audacity:
A solution is too decrease the time of each note. By clicking on Triple Oscillator in Beat + Bassline Editor, the Triple Oscillator setting dialog appears. Select the ENV/LFO tab, and set the hold to be zero, by changing the HOLD knob.
Now exporting the file, we see that the notes are not touching each other.
lmms4. Adding Steps to Beat + Bassline Editor
The Beat + Bassline Editor has a default of 16 steps
For 4/4 time signature, 16 steps correspond to 1 bar or 4 beats. If we add steps, by right-clicking on the pattern and by selecting the Add Steps option, we have 32 steps, or 2 bars.
With the tempo of 140 beats per minute, one beat is 0.42857 seconds (1/140). Thus, 1 bar is 1.7143 seconds.
This is the setting of the Song Editor and Beat + Bassline Editor:
Now each block in the Song Editor is 2 bars. We select 2 beginning bars, have silence for middle 2 bars, and then select another two bars. Thus the silence is 2*1.7143 seconds = 3.4286 seconds as verified by the audio opened in Audacity:
lmms3. Timing in LMMS
Change the tempo from 140 beats per minute to 60 beats per minute. This makes it easier to see the timing relations
For the usual time signature of 4/4, 1 beat is now 1 second in duration, and 1-bar is 4-seconds in duration.
Remove the Kicker instrument from Beat + Bassline editor, and add drum sample from My Samples.
Use this pattern for the Beat + Bassline editor and Song Editor. (If the image is too small, you can click to get the original size)
In the Song Editor we can see that bars 2 and 3 and not selected. That corresponds to 8-seconds, from 4 to 12, of silence.
Within the Beat + Bassline editor we can see that samples exist at 0-second, 1-second and 3-second. It should be noted that four position separation in this editor correspond to 1 second time-difference, for a 60 beats per minute tempo.
lmm2. Using My Samples in LMMS
The project My Samples is where you will place your samples. In addition, it also has some pre-built samples.
First, remove the Kicker instrument from Beat+Bassline editor.
Open up My Samples (icon on left-side panel), and choose the latin subfolder. Drag the first sample to Beat+Bassline editor. Do the same for the second sample. Now the Beat + Bassline editor should look like this:
After making the patterns in the two editors, exporting the file to wav, we can open in Audacity.
The first file is the result, while the 2nd and 3rd are the actual samples in the LMMS folder.
lmms1. Introduction to LMMS
We can use Python or another language to create any audio. However, it does not provide the interactive experience, such as making changes and listening to the result. This is where a DAW (Digital Audio Workstation) like LMMS is helpful. It is free and open-source.
It is best to use Python to create repetitive parts and for analysis.
Most of what Python will be used here is to extract features, so they may be used to create new samples, etc.
It is assumed that you have installed and setup LMMS. Here we will create a very simple audio.
When LMMS is opened, the default tempo is 140 and there is a Kicker instrument on Beats and Bass Editor. Click on two locations in the pattern so it looks like this:
We added two instances of the audio sample at positions 9 and 13. Also, position 1 in Song Editor has been switched. Next, we can use the File menu to export the file as a wav file.
The file is opened in Audacity, which is also free and open-source. We can see two replicas of the sample at two positions that were created in the Beats and Bass Editor. Also we note the frequency of the sample is changing from high to low (within a small range). Even though the amplitude is 1, the effective volume is low because of our inability to detect low-frequencies (fletcher-munson equal loudness curves).
Monday, June 1, 2015
nlp31. Reading text with PlaintextCorpusReader in Python NLTK
Rather than creating our corpus, it is instructive to read corpus in nltk_data/corpora.
In that module, they define the variable movie_reviews, which we can use if we import it.
We can use that corpus with 2000 reviews, 1000 positive and 1000 negative. They use pos and neg folders to store the two categories.
# nlp31.py
from __future__ import print_function, division
from nltk.corpus.reader import PlaintextCorpusReader
from nltk.data import path
path = path[0] + '/corpora/movie_reviews'
mov_rev = PlaintextCorpusReader(path,'.*.txt')
fils = mov_rev.fileids()
print('len(fils) =',len(fils))
print('First 10 files')
for fil in fils[:10]: print(fil)
nPos = len([fil for fil in fils if fil.startswith('pos')])
nNeg = len([fil for fil in fils if fil.startswith('neg')])
print("pos - %d, neg - %d" % (nPos,nNeg))
print("First 10 words of 1st review")
words = mov_rev.words(fils[0])
for word in words[:10]:
print(word,end=' ')
#len(fils) = 2000
#First 10 files
#neg/cv000_29416.txt
#neg/cv001_19502.txt
#neg/cv002_17424.txt
#neg/cv003_12683.txt
#neg/cv004_12641.txt
#neg/cv005_29357.txt
#neg/cv006_17022.txt
#neg/cv007_4992.txt
#neg/cv008_29326.txt
#neg/cv009_29417.txt
#pos - 1000, neg - 1000
#First 10 words of 1st review
#plot : two teen couples go to a church party
Subscribe to:
Posts (Atom)















