Python Forum
Is there a simplified way to achieve this
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a simplified way to achieve this
#1
Hi guys,
Wondering if there is a better way to achieve this? In an ideal world the level value would count down -1000 to -6000 over 2 seconds.
I'm a complete noob with this. I'm trying to control an audio console with this code.
Thanks
Andrew.

#Set channel 6 to -60

s.sendall("set MIXER:Current/InCh/Fader/Level 5 0 -1000\n".encode())
time.sleep(.500)
s.sendall("set MIXER:Current/InCh/Fader/Level 5 0 -2000\n".encode())
time.sleep(.500)
s.sendall("set MIXER:Current/InCh/Fader/Level 5 0 -4000\n".encode())
time.sleep(.500)
s.sendall("set MIXER:Current/InCh/Fader/Level 5 0 -5000\n".encode())
time.sleep(.500)
s.sendall("set MIXER:Current/InCh/Fader/Level 5 0 -6000\n".encode())
Reply
#2
Use a for loop with range
for value in range(-1000, -7000, -1000):
    print(f'set MIXER:Current/InCh/Fader/Level 5 0 {value}\n')
Output:
set MIXER:Current/InCh/Fader/Level 5 0 -1000 set MIXER:Current/InCh/Fader/Level 5 0 -2000 set MIXER:Current/InCh/Fader/Level 5 0 -3000 set MIXER:Current/InCh/Fader/Level 5 0 -4000 set MIXER:Current/InCh/Fader/Level 5 0 -5000 set MIXER:Current/InCh/Fader/Level 5 0 -6000
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to do it in simplified Python code Jacks 0 1,449 Jul-14-2020, 04:21 PM
Last Post: Jacks
  Transform simplified dictionary to nested dictionaries bhojendra 1 2,369 Jul-02-2019, 02:05 PM
Last Post: ichabod801
  How to achieve close to 1ms time.sleep kwekey 1 15,018 Mar-25-2019, 02:52 AM
Last Post: Larz60+
  Can my program be simplified? Steffenwolt 0 2,108 Jul-14-2018, 07:46 PM
Last Post: Steffenwolt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020