worldmaking / mischmasch

https://www.alicelab.world/msvr
MIT License
9 stars 1 forks source link

dealing with feedback connections #182

Closed michaelpalumbo closed 1 year ago

michaelpalumbo commented 1 year ago

@grrrwaaa will attempt to handle this directly within Audio.js rather than using the connection cable='history' in patch.document

michaelpalumbo commented 1 year ago

attempting this now, resulted in an app crash with the following printout:

operations
 speaker(0);
operations
 speaker(0);
num speakers [ 'speaker' ]
operations
 speaker(0);
operations
 speaker(0);
operations
 speaker(0);
operations
 paramad487c9d13fe4add94dcabc977aa4276_freq = param(cycle_ad487c9d13fe4add94dcabc977aa4276_freq, 3, -20000, 20000);
octsub_3 = sub(paramad487c9d13fe4add94dcabc977aa4276_freq, 1.75);
octpow4 = add(2, octsub_3);
hz5 = mul(55, octpow4);
sinusoid_ad487c9d13fe4add94dcabc977aa4276 = cycle(hz5, sinusoid_44f1913712c443d196d980bd05bfbf25);
param44f1913712c443d196d980bd05bfbf25_freq = param(cycle_44f1913712c443d196d980bd05bfbf25_freq, 3, -20000, 20000);
octsub_0 = sub(param44f1913712c443d196d980bd05bfbf25_freq, 1.75);
octpow1 = add(2, octsub_0);
hz2 = mul(55, octpow1);
sinusoid_44f1913712c443d196d980bd05bfbf25 = cycle(hz2, sinusoid_ad487c9d13fe4add94dcabc977aa4276);
speaker(sinusoid_44f1913712c443d196d980bd05bfbf25);
[nodemon] app crashed - waiting for file changes before starting...
michaelpalumbo commented 1 year ago

2 cycle ops patched into each other

{
  "1761ecfc002741d3ae507cb20566f095": {
    "category": "speaker",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "inlet",
          "range": [
            -1,
            1
          ]
        },
        "index": 0,
        "kind": "inlet",
        "name": "audio"
      }
    ],
    "name": "speaker",
    "outputs": [],
    "position": [
      -0.15314626693725586,
      1.5988186597824097,
      -1.4515100717544556
    ],
    "quaternion": [
      -0.1531561116941844,
      0.11678559922848755,
      0.022740268450105093,
      0.9810133633500556
    ],
    "uuid": "1761ecfc002741d3ae507cb20566f095"
  },
  "50db2ac87e33430caac00313bba37487": {
    "category": "source",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "knob",
          "range": [
            -10,
            7
          ],
          "value": 0
        },
        "index": 0,
        "kind": "knob",
        "name": "freq",
        "range": [
          -10,
          7
        ],
        "trim": "add",
        "value": 0
      },
      {
        "_props": {
          "index": 1,
          "kind": "inlet",
          "range": [
            0,
            1
          ],
          "value": 0
        },
        "index": 1,
        "kind": "inlet",
        "name": "reset"
      }
    ],
    "name": "cycle",
    "outputs": [
      {
        "_props": {
          "history": false,
          "index": 0,
          "kind": "outlet"
        },
        "connections": {
          "8c0dd8b6d3494fd49e9b7e767380f08e": {
            "reset": "cable"
          }
        },
        "name": "sinusoid"
      }
    ],
    "position": [
      -0.9971200227737427,
      1.8003504276275635,
      -0.43817493319511414
    ],
    "quaternion": [
      0.07539845206201772,
      0.8703659225129874,
      -0.12718232732750334,
      0.46968379076534733
    ],
    "uuid": "50db2ac87e33430caac00313bba37487"
  },
  "8c0dd8b6d3494fd49e9b7e767380f08e": {
    "category": "source",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "knob",
          "range": [
            -10,
            7
          ],
          "value": 0
        },
        "index": 0,
        "kind": "knob",
        "name": "freq",
        "range": [
          -10,
          7
        ],
        "trim": "add",
        "value": 0
      },
      {
        "_props": {
          "index": 1,
          "kind": "inlet",
          "range": [
            0,
            1
          ],
          "value": 0
        },
        "index": 1,
        "kind": "inlet",
        "name": "reset"
      }
    ],
    "name": "cycle",
    "outputs": [
      {
        "_props": {
          "history": false,
          "index": 0,
          "kind": "outlet"
        },
        "connections": {
          "50db2ac87e33430caac00313bba37487": {
            "freq": "cable"
          },
          "1761ecfc002741d3ae507cb20566f095": {
            "audio": "cable"
          }
        },
        "name": "sinusoid"
      }
    ],
    "position": [
      -1.1307250261306763,
      1.791398286819458,
      -0.850423276424408
    ],
    "quaternion": [
      0.07850162524612218,
      0.7876596193754402,
      -0.13348999450677132,
      0.5963305192708266
    ],
    "uuid": "8c0dd8b6d3494fd49e9b7e767380f08e"
  }
}
grrrwaaa commented 1 year ago

I added Audio.docHasFeedback(doc) which returns true if the doc has a feedback path in it. You can use this anywhere.

Also if a feedback patch makes it through to the audio generator, it will not crash anymore, but just keep on playing the previous graph instead.

michaelpalumbo commented 1 year ago

Thank you Graham! I gave it more thought and I've decided not to implement it for today. The user experience of attempting a unwittingly making feedback connection only to have the cable disappear would be more confusing than making the connection and not hearing a change. However, this function will be useful going forward, as feedback cables should have a different appearance, than other cables, for instance!

michaelpalumbo commented 1 year ago

Ok great. Thanks!!

On Fri, Sep 30, 2022 at 3:24 PM Graham Wakefield @.***> wrote:

I added Audio.docHasFeedback(doc) which returns true if the doc has a feedback path in it. You can use this anywhere.

Also if a feedback patch makes it through to the audio generator, it will not crash anymore, but just keep on playing the previous graph instead.

— Reply to this email directly, view it on GitHub https://github.com/worldmaking/mischmasch/issues/182#issuecomment-1263935402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASLT4ITAR4QMMG345675ZDWA445PANCNFSM6AAAAAAQWC54MU . You are receiving this because you authored the thread.Message ID: @.***>

--

https://linktr.ee/thispatcher -- all things me https://linktr.ee/exitpoints https://linkr.ee/exitpoints -- exit points concert series