electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Developers' Corner
seq1 - A Practice Tool MIDI Sequencer for Linux
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sun Aug 09, 2020 12:50 pm    Post subject: seq1 - A Practice Tool MIDI Sequencer for Linux Reply with quote  Mark this post and the followings unread

The name is tentatively 'seq1', if I find that already exists, I'll change it.

Anyway, I've wanted a metronomic tool for practicing guitar and ukulele for a long time. For what I do, I just need a bass part and some simple percussion. But listening to the same loop over and over gets boring quickly.

I'm using a Raspberry Pi 4 (8G) for this, but I believe it would work for any Linux system that has a USB MIDI device. I cannot, however, even guess at how bad or good the timing will be on another system. I am not in a position to make it work on Windows systems.

I wanted a MIDI sequencer that can improvise a bit. Such as certain notes being random choice between several different pitches.

Stipulation: The program is written in C. Not C++. It is basically a wrapper around the amidi command.

Stipulation: This program has a few best practice violations. Shocked However, that helped keep it simple and is actually pretty tight sounding even though the clock used is atrocious in a technical sense. I found clock jitter in the 2 millisecond range. Again, it doesn't sound jittery or off. My understanding is that there is no true precision clock in the Raspbian kernel, so it's possible other linux installations might work better. I only mention this because I've measured jitter and know it's there, but at the same time I don't hear it. One result of a best practice violation causes the system to run with a loadavg of about 1.05 1.05 1.05 and one CPU runs near 100% use. My use of this tool has been on a system that does pretty much nothing else (which is what I would suggest).

Stipulation: I am writing this as a tool to use in my studio, to make practicing more fun. I am not in a position to spend the time to make it a GUI based bestest tool ever. It is what it is.

This is a command line tool. It is as simple as I could make it. A sequence is programmed with source language that defines note events. The tool compiles the source into a timestamp sorted event list and then the integrated event player works on the event list by starting a clock at zero and watching the clock until it can send a MIDI event. The MIDI event is sent using the system() function to execute an 'amidi' command which does the MIDI data transfer. Currently, only note on and note off messages are supported during the sequence. Continuous controller messages may be sent before the sequence starts, but currently, they are not supported during the sequence play. Bender messages are not currently supported.

The tool doesn't record. A note event is given the time to play as a tick number, pitch is MIDI note number, velocity is a value from 1 to 127. Any text editor can write the .seq file. Commands are provided for 2 level nest of looping with loop count control. This allows repeated sections of music to be coded just once and looped N times.

The tool supports transpose amount per MIDI channel specified on the command line.

Given the above, I'm considering posting the source code providing people won't laugh too hard. However, the caveat is: download and do with it as you will. I know it's not "pro quality", but it works well enough that I've practiced several hours with it and find it to have far better timing than I do. In fact, I'm considering adding a random variance feature to allow controlling how robotic it sounds.

Compiling the source code is easy, there's no Makefile, it's just a gcc command.

There's a lot of things a lot of folks will say it needs. What it has is what I need Cool I'm guessing this is a sort of open source thing? I know there's a whole official protocol with that which I probably am not following. Given enough interest, I would post updates occasionally. I know about github, I'm not interested in that route - I don't want to spend a ton of time in more coding than I need to - I want to USE the tool, not maintain it. With that caveat, anyone who would download it can modify it as they desire for their own needs.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sun Aug 09, 2020 1:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's a snippet of a practice session. Obviously, I need a lot more, but you can hear also the bass and percussion (just a ride cymbal). The bass is a Karplus-Strong design that should eventually end up in a module. The recording was tossed together just to give an idea of what it does. It is the sequencer playing bass and percussion and me playing a baritone ukulele.

This sequence source code looks like this:
Code:
bpm=160
beats-per-measure=4
end-gap=0.040                 # each note ends the amount of time before theoretical length
ticks-per-measure=16

CC=A1 20 127                  # vol
CC=A1 62 110                  # lin decay
CC=A1 95 21                   # reflection filter a0
CC=A1 01 127                  # pluck pulse length
CC=A1 71 30                   # loop HP amplitude
CC=A1 21 99                   # loop HP b1
CC=A1 72 70                   # square
CC=A1 22 30                   # excite amplitude
CC=A1 61 40                   # excite LP filt a0

[bass]
000 CODA 002 32
000 LOOP 000 4
000 M hn A1 43 127
008 M qn A1 43 104
012 M qn A1 43 104
016 M qn A1 41 104
020 M qn A1 40 104
024 M hn A1 41 104

#032 M hn A1 43 104
032 E000 hn A1 43 104
032 E000 hn A1 46 104
032 E000 hn A1 48 104

#040 M hn A1 43 104
040 E001 hn A1 43 104
040 E001 hn A1 46 104
040 E001 hn A1 48 104

048 M qn A1 46 104
052 M qn A1 43 104
056 M qn A1 46 104
060 M qn A1 48 104
064 GOTO 000

###################################################

064 LOOP 001 2
064 M hn A1 50 127
072 M qn A1 50 104
076 M qn A1 50 104
080 M qn A1 48 104
084 M qn A1 47 104
088 M hn A1 48 104

096 E002 hn A1 50 104
096 E002 hn A1 53 104
096 E002 hn A1 55 104

104 E003 hn A1 50 104
104 E003 hn A1 53 104
104 E003 hn A1 55 104

112 M qn A1 53 104
116 M qn A1 50 104
120 M qn A1 53 104
124 M qn A1 55 104
128 GOTO 001
128 JUMP 002

[ride]
000 LOOP 031 768
000 M sn B1 48 127
008 M sn B1 48 100
012 M sn B1 48 100
016 GOTO 031



seq1_demo.mp3
 Description:
seq1 demo

Download (listen)
 Filename:  seq1_demo.mp3
 Filesize:  913.59 KB
 Downloaded:  402 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sun Aug 09, 2020 3:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's another sample, just the sequenced parts, but I've added bass drum and snare in a simple thing to rock to on a guitar Cool In this you can hear the random improvisation on the bass. The percussion could also be embellished.


seq1_demo_just_seq1.mp3
 Description:
A seq1 demo of just the sequenced parts

Download (listen)
 Filename:  seq1_demo_just_seq1.mp3
 Filesize:  1.54 MB
 Downloaded:  410 Time(s)


_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use