Perl, musica automagica

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Perl, musica automagica - Presentation Transcript

    1. Perl Musica Automagica!
    2. Andrew Plotkin
    3. Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura ché la diritta via era smarrita. Ahi quanto a dir qual era è cosa dura esta selva selvaggia e aspra e forte che nel pensier rinova la paura! Tant'è amara che poco è più morte; ma per trattar del ben ch'i' vi trovai, dirò de l'altre cose ch'i' v'ho scorte. Io non so ben ridir com'i' v'intrai, tant'era pien di sonno a quel punto
    4. Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura ché la diritta via era smarrita. Ahi quanto a dir qual era è cosa dura esta selva selvaggia e aspra e forte che nel pensier rinova la paura! Tant'è amara che poco è più morte; ma per trattar del ben ch'i' vi trovai, dirò de l'altre cose ch'i' v'ho scorte. Io non so ben ridir com'i' v'intrai, tant'era pien di sonno a quel punto
    5. Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura ché la diritta via era smarrita. Ahi quanto a dir qual era è cosa dura esta selva selvaggia e aspra e forte che nel pensier rinova la paura! Tant'è amara che poco è più morte; ma per trattar del ben ch'i' vi trovai, dirò de l'altre cose ch'i' v'ho scorte. Io non so ben ridir com'i' v'intrai, tant'era pien di sonno a quel punto
    6. while( @notes ) { if( scalar @notes >= $tuple_size + 1 ) { my $key = join ' ', @notes[0 .. $tuple_size-1]; push @{ $tuples{ $key } } , $notes[$tuple_size]; } shift @notes; }
    7. Markov Chain di grado N
    8. Algorithm:: MarkovChain
    9. $chain->seed( symbols => \\@notes , longest => $tuple_size )
    10. MIDI / MIDI::Simple • read, compose, modify, and write MIDI files • Sean Burke++
    11. while( $n-- ) { my @tuple = @{ $tuples{ $k } }; my $last = $tuple[ int rand scalar @tuple ]; n( $last, $tempo[ rand scalar @tempo ], 'f' ); my @next_tuple = split / /, $k; shift @next_tuple; push @next_tuple, $last; if (defined $tuples{ join ' ', @next_tuple }) { $k = join ' ', @next_tuple; ++$hit; } else { $k = ( keys %tuples )[ int rand $l ]; ++$miss; } }
    12. hobbes:~/Desktop larsen$ perl mozart.pl \\ -f peaches.mid -t 6 -s 4 -n 100 Fetching info from MIDI file... # Type Track Name Instrument 1 MTrk 2 MTrk Peaches en Regalia original 3 MTrk Drums Drums 4 MTrk Saxes Saxes 5 MTrk Brass Brass 6 MTrk Bass Bass 7 MTrk Piano Piano 8 MTrk Synth Synth 9 MTrk Clarinet Clarinet 10 MTrk Guitar Guitar 11 MTrk M-Playback*recorded M-Playback
    13. Fetching track 6... I've learnt 376 tuples... Average number of buckets per key: 1.90159574468085... 1. '38 41 29 34' => 35 2. '43 35 35 42' => 47 3. '41 42 43 46' => 38 38 4. '40 35 42 47' => 42 42 42 42 42 42 5. '46 38 39 40' => 41 6. '40 42 40 40' => 35 47 35 35 35 35 35 7. '42 40 37 36' => 40 40 40 40 40 40 40 40 8. '54 52 49 42' => 49 9. '42 47 42 35' => 35 35 35 35 35 35 35 35 10. '40 42 40 43' => 43 11. '46 33 33 33' => 45 12. '45 51 52 45' => 44 13. '48 40 40 44' => 32 14. '53 41 41 41' => 43
    14. Demo
    15. I am quite struck by them.. from listening to them you can tell they are meant to have musical structure, and they sound like they are intentionally musical, but they contain no coherent musical \"thought\"
    16. “Peaches en regalia”
    17. “Frame by frame”
    18. “Epitaph”
    19. MIDI MIDI::Simple Algorithm::MarkovChain Getopt::*
    20. http://larsen.perlmonk.org/perl/mozart.html

    + Stefano RodighieroStefano Rodighiero, 3 years ago

    custom

    786 views, 0 favs, 1 embeds more stats

    An algorithmic approach to music generation

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 786
      • 784 on SlideShare
      • 2 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 15
    Most viewed embeds
    • 2 views on http://miguelprofesortecno.wordpress.com

    more

    All embeds
    • 2 views on http://miguelprofesortecno.wordpress.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories