Music21 Getting All notes with Durations
<p>Im trying to get all notes with their durations(measures).</p>

<pre><code>from music21 import *

allBach = corpus.search('bach')

x = allBach[0]
p = x.parse()

partStream = p.parts.stream()

for n in p.pitches:
    print "Pitch: " + str(n)

print "*************"

for n in p.notes:
    print "Note: " + str(n)
#print "Duration " + str(x.parse().duration)
</code></pre>

<p>Above code produces following output</p>

<pre><code>Pitch: E5
Pitch: G5
Pitch: A5
Pitch: D5
Pitch: F#5
Pitch: A5
Pitch: D5
Pitch: F#5
Pitch: A5
Pitch: C6
Pitch: G4
Pitch: B4
Pitch: D5
*************
</code></pre>

<p>I know that pitch is a just name of the note with its octave, but Im trying to get note values with its durations(measures). </p>

<p>Also if you can help me on this, could you also explain why p.notes returns nothing.
Thank you.</p>