FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording by to-the-sun

View this thread on steempeak.com
· @to-the-sun ·
$46.48
FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording
![amanuensis final-03.png](https://cdn.steemitimages.com/DQmZV2Tcxj6TUfJa83JeYeQNnfgiqWJv3FLXPK5VF9wFndx/amanuensis%20final-03.png)
*logo by [@camiloferrua](https://www.behance.net/CamiloFerrua)*

#### Repository
https://github.com/to-the-sun/amanuensis
> The Amanuensis is an automated songwriting and recording system aimed at ridding the process of anything left-brained, so one need never leave a creative, spontaneous and improvisational state of mind, from the inception of the song until its final master. The program will construct a cohesive song structure, using the best of what you give it, looping around you and growing in real-time as you play. All you have to do is jam and fully written songs will flow out behind you wherever you go. 

If you're interested in trying it out, please get a hold of me! Playtesters wanted!

### New Features
- What feature(s) did you add?

The Singing Stream has been fundamentally reworked to make it faster, more efficient, less obtrusive for users and cleaner in the code as well. This major overhaul was accomplished by abandoning the previous reliance on `poly~` in favor of a new system utilizing scripting to dynamically create abstractions on the fly. Each new stream (i.e. source you would like to use as a MIDI instrument: audio streams, game controllers, the mouse, etc.) must be handled separately; now each time a new stream is introduced a new abstraction is created for it, which loads in a fraction of a second silently in the background.

 Previously a new `poly~` voice would need to be loaded for each stream and because of the way the object works all of the previously established voices would also need to be reloaded (a process requiring many seconds). This made `poly~` very slow and I had implemented an entire loading screen, disabling the UI, to be displayed while it was working. This was rather obtrusive and could be confusing for the user. In addition, I have continually found the `poly~` object to be a confounding source of bugs and the more I code with this language, the more I'm inclined to recommend avoiding it altogether. Dynamically creating abstractions with scripting makes the code so much easier to understand, streamlined and perform much better.

- How did you implement it/them?

> If you're not familiar, Max is a visual language and textual representations like those shown for each commit on Github aren't particularly comprehensible to humans. You won't find any of the commenting there either. Therefore, I will present the work that was completed using images instead. Read the comments in those to get an idea of how the code works. I'll keep my description here about the process of writing that code.

These are the primary commits involved:
- [Commit #1](https://github.com/to-the-sun/amanuensis/commit/8deed40c404d1c5bed4bee073882bc8cec884d3c)

The new subpatcher seen below manages the creation of the stream.maxpat abstractions. It essentially replaces the previous `p target`. These new abstractions can be instantiated with unique arguments denoting the source name of the streams. This facilitates one of many conveniences and simplifications over the previous setup in that before, source names had to be stored and recalled with `coll ---sources`, but can now be easily referenced with `#1`.

![](https://cdn.steemitimages.com/DQmUF1bQmCYN28LjqfLK88ETuQvUfmUagj2c5tePikw7qEy/image.png)
*the new `streams` subpatcher in singingstream.maxpat, **complete with commenting***

If you're not familiar with Max, an abstraction is a patch, or portion of code, (.maxpat file) that can be referenced by name anywhere throughout your code and, if it can be found somewhere within the Max search path, it will be loaded and function just like any other subpatcher. The closest thing it might be analogous to in a more traditional language might be a Class.

Until now, I had not realized that whole abstractions could be created dynamically using scripting. This opens up a whole new world of possibilities, using code to create whole batches of new code all at once. The main abstraction created in this update is streams.maxpat, seen below.

![](https://cdn.steemitimages.com/DQmVffao13v98gwmT8GsBsFdiNpjoRJeoTQ5pYjjNVQvnDr/image.png)
*the new `stream` abstraction, **complete with commenting***

This patch functions much the same as the old polysingingstream.maxpat that it replaces, but adjustments have been required all throughout it. One of the main ones is the reference to `#1` instead of `coll ---sources`. Beyond that however, the two subpatchers below were also reworked completely in this new update.

![](https://cdn.steemitimages.com/DQmapup9NKAKudAm8NPnmWLb28MNfrprBycEAwhqAhw3pPa/image.png)
*`p initialize` inside the new `stream` abstraction, **complete with commenting***

![](https://cdn.steemitimages.com/DQmWza8WFNtvMu7kUaGy8h8UusskhZ1pi2X5cnppgXWBipw/image.png)
*`p calibrating? ` inside the new `stream` abstraction, **complete with commenting***

Because it works so well to dynamically create abstractions this way, I decided to take it one step further and reimagined another subpatcher, `cc`, in the same light. It was already using scripting, but was doing so object by object, which requires you to explicitly connect them with patch cords and gets messy fast. Using abstractions is so much cleaner.

![](https://cdn.steemitimages.com/DQmRBTs5hV9JcSs5qV3MyuwhJUxwdkaoYV9dHQLtMBHAwbc/image.png)
*the new `cc` subpatcher in singingstream.maxpat, **complete with commenting***

The code above identifies new MIDI sources and creates abstractions for them. The newly written abstraction below parses, tags and initializes the MIDI streams.

![](https://cdn.steemitimages.com/DQmTzMAjRuU82RBbdJ3egz6VwZkNJZw4nZBQCasi373u5Pr/image.png)
*the new `cc_source` abstraction, **complete with commenting***


#### GitHub Account
https://github.com/to-the-sun
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 93 others
properties (23)
post_id71,263,316
authorto-the-sun
permlinkfaster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis
categoryutopian-io
json_metadata{"tags":["utopian-io","development","max","open-source","max-msp"],"image":["https:\/\/cdn.steemitimages.com\/DQmZV2Tcxj6TUfJa83JeYeQNnfgiqWJv3FLXPK5VF9wFndx\/amanuensis%20final-03.png","https:\/\/cdn.steemitimages.com\/DQmUF1bQmCYN28LjqfLK88ETuQvUfmUagj2c5tePikw7qEy\/image.png","https:\/\/cdn.steemitimages.com\/DQmVffao13v98gwmT8GsBsFdiNpjoRJeoTQ5pYjjNVQvnDr\/image.png","https:\/\/cdn.steemitimages.com\/DQmapup9NKAKudAm8NPnmWLb28MNfrprBycEAwhqAhw3pPa\/image.png","https:\/\/cdn.steemitimages.com\/DQmWza8WFNtvMu7kUaGy8h8UusskhZ1pi2X5cnppgXWBipw\/image.png","https:\/\/cdn.steemitimages.com\/DQmRBTs5hV9JcSs5qV3MyuwhJUxwdkaoYV9dHQLtMBHAwbc\/image.png","https:\/\/cdn.steemitimages.com\/DQmTzMAjRuU82RBbdJ3egz6VwZkNJZw4nZBQCasi373u5Pr\/image.png"],"links":["https:\/\/www.behance.net\/CamiloFerrua","https:\/\/github.com\/to-the-sun\/amanuensis","https:\/\/github.com\/to-the-sun\/amanuensis\/commit\/8deed40c404d1c5bed4bee073882bc8cec884d3c","https:\/\/github.com\/to-the-sun"],"app":"steemit\/0.1","format":"markdown"}
created2019-03-11 21:47:30
last_update2019-03-11 21:47:30
depth0
children5
net_rshares66,965,939,323,947
last_payout2019-03-18 21:47:30
cashout_time1969-12-31 23:59:59
total_payout_value35.210 SBD
curator_payout_value11.265 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length5,878
author_reputation25,703,957,827,688
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (157)
@helo ·
$12.91
- Good post with images of the development.
- Please include a commit list in your future articles.  I used this link to evaluate the code changes: https://github.com/to-the-sun/amanuensis/compare/master@%7B14day%7D...master
- Hard to evaluate the code, commit messages or comments as it is not a traditional coding environment.
- Post could benefit from a section with a list of the previous articles, tutorials or videos previously produced.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-2-1-2-1-3-4-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , ,
properties (23)
post_id71,276,184
authorhelo
permlinkre-to-the-sun-faster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis-20190312t022235717z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https:\/\/github.com\/to-the-sun\/amanuensis\/compare\/master@%7B14day%7D...master","https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/2-2-1-2-1-3-4-","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"],"app":"steemit\/0.1"}
created2019-03-12 02:22:36
last_update2019-03-12 02:22:36
depth1
children2
net_rshares18,600,932,288,785
last_payout2019-03-19 02:22:36
cashout_time1969-12-31 23:59:59
total_payout_value9.778 SBD
curator_payout_value3.135 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length893
author_reputation119,612,833,307,875
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (19)
@to-the-sun ·
- The commit I linked to in the post encompassed all of the work done for this update. Sorry I didn't commit more often, but I've had a lot of external factors weighing on me these past couple months. I shall try to be more professional in the future.
- If you want to see a history of all the work done, blog posts, etc., you should just check out my Steemit blog. Now that you mention it, I'll include a link to it from now on.
Thanks!
properties (22)
post_id71,315,681
authorto-the-sun
permlinkre-helo-re-to-the-sun-faster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis-20190312t154155473z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit\/0.1"}
created2019-03-12 15:41:57
last_update2019-03-12 15:41:57
depth2
children0
net_rshares0
last_payout2019-03-19 15:41:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length437
author_reputation25,703,957,827,688
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Thank you for your review, @helo! Keep up the good work!
properties (22)
post_id71,437,507
authorutopian-io
permlinkre-re-to-the-sun-faster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis-20190312t022235717z-20190314t050320z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-03-14 05:03:21
last_update2019-03-14 05:03:21
depth2
children0
net_rshares0
last_payout2019-03-21 05:03:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length56
author_reputation152,913,012,544,965
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### Hi @to-the-sun!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
post_id71,277,972
authorsteem-ua
permlinkre-faster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis-20190312t032846z
categoryutopian-io
json_metadata{"app":"beem\/0.20.18"}
created2019-03-12 03:28:48
last_update2019-03-12 03:28:48
depth1
children0
net_rshares0
last_payout2019-03-19 03:28:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length289
author_reputation23,203,609,903,979
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Hey, @to-the-sun!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id71,357,914
authorutopian-io
permlinkre-faster-and-more-efficient-loading-of-streams-in-singing-stream-a-new-feature-for-the-open-source-project-the-amanuensis-20190313t043451z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-03-13 04:34:54
last_update2019-03-13 04:34:54
depth1
children0
net_rshares0
last_payout2019-03-20 04:34:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length592
author_reputation152,913,012,544,965
root_title"FASTER AND MORE EFFICIENT LOADING OF STREAMS IN Singing Stream: a new feature for the open-source project The Amanuensis: Automated Songwriting and Recording"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000