Author Topic: Knight Rider ; dash and voice modulator  (Read 3498 times)

0 Members and 1 Guest are viewing this topic.

Offline mynameispaul

  • Newbie
  • Posts: 49
    • View Profile
Knight Rider ; dash and voice modulator
« on: September 06, 2020, 06:19:01 am »
KITT  dash simulator
- animated lights and sound
- power up/down sequence

KITT voice modulator
- select from provided MP3 to play while the voice modulator is animated
* KITT dash and VoiceBox.zip (Filesize: 2.3 MB, Downloads: 197)
KITT-dash.jpg
* KITT-dash.jpg (Filesize: 101.38 KB, Dimensions: 1358x410, Views: 263)
KITT-talk.jpg
* KITT-talk.jpg (Filesize: 9.85 KB, Dimensions: 319x225, Views: 218)

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Knight Rider ; dash and voice modulator
« Reply #1 on: September 06, 2020, 06:49:15 am »
Ran the dash simulator... and got the following message...

No changes made. Downloaded. Placed in its own directory. Loaded and executed the Dash simulator...

QB64v1.4 Linux Mint 19.3
Screenshot at 2020-09-06 20-43-06.png
* Screenshot at 2020-09-06 20-43-06.png (Filesize: 81.3 KB, Dimensions: 949x617, Views: 193)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Knight Rider ; dash and voice modulator
« Reply #2 on: September 06, 2020, 12:07:51 pm »
@johnno56

Did you see this from ReadMe?
Quote
ReadMe file for:
- KITT_dash
- KITTVM_sound

Put all files in the folder where you have QB64

...\(QB64 folder)
      \PgmFiles
         \KITT_dash
            \tv
            \voiceBox
               \KARR
               \KITT
         \KITTTalk

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Knight Rider ; dash and voice modulator
« Reply #3 on: September 07, 2020, 02:34:07 pm »
Paul that is totally awesome! I grew up with that show and could recognize the panel and sounds. I also like how you added a video on the right side of the panel. Plus you tossed in the code for the voice modulator as a second program for people to learn by it. Great job!

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: Knight Rider ; dash and voice modulator
« Reply #4 on: September 09, 2020, 02:55:19 am »
Hi @ mynameispaul

Great stuff, got me very nostalgic so i decided to meddle and put this together, now your voice can be displayed using the lightbars! This is something i SOOOOOO wanted to be able to do when i was 6, only took 31 years! You can use the same method to get the light bars to sync with your sound files too.

This WILL ONLY RUN USING SDL QB64!
Code: QB64: [Select]
  1. '// Knight Rider industries voice modulator v.01
  2. '// By John Onyon a.k.a Unseen Machine
  3.  
  4. SCREEN _NEWIMAGE(800, 600, 32)
  5.  
  6.  
  7.   _LIMIT 30
  8.  
  9.   CLS
  10.  
  11.   KB$ = INKEY$
  12.  
  13.   IF NOT Recording% THEN
  14.     _PRINTSTRING (0, 0), "Press Enter to start recording."
  15.   ELSE
  16.     Time! = TIMER(.01) - TM!
  17.     _PRINTSTRING (0, 0), STR$(Time!) + " Seconds recorded, press ESC to stop."
  18.   END IF
  19.  
  20.   IF KB$ = CHR$(27) THEN '// ESC
  21.     IF Recording% = -1 THEN
  22.       Mic_End '// End the recording
  23.       Mic_Save "TmpSnd.wav"
  24.       Recording% = 0
  25.       PlayBack% = -1
  26.       _SNDCLOSE (snd&)
  27.       snd& = _SNDOPEN("Tmpsnd.wav")
  28.       _SNDPLAY snd&
  29.     END IF
  30.   ELSEIF KB$ = CHR$(13) THEN '// Enter
  31.     IF NOT PlayBack% THEN
  32.       '// Record audio @ 3600 samples per second
  33.       Recording% = -1
  34.       Mic_Start 3600
  35.       TM! = TIMER(.01)
  36.     END IF
  37.   END IF
  38.  
  39.     l! = Mic_Get_Sample(_SNDGETPOS(snd&) * 3600)
  40.     Left! = -(l! / 3600) * 5
  41.     Right! = Left!
  42.     Middle! = Left! * 2
  43.     '    PRINT l!, r!, Left!, Right!, Middle!
  44.   ELSE
  45.     PlayBack% = 0
  46.     Left = 0
  47.     Right! = 0
  48.     Middle! = 0
  49.   END IF
  50.  
  51.  
  52.   '// Draw the light bars
  53.   x% = 320
  54.   FOR Col% = 0 TO 2
  55.     y% = 130
  56.     FOR Row% = 0 TO 29
  57.       SELECT CASE Col%
  58.         CASE 0
  59.           IF Row% > (14 - Left!) AND Row% < (15 + Left!) THEN Clr = _RGB32(255, 0, 0) ELSE Clr = _RGB32(200, 0, 0)
  60.  
  61.         CASE 1
  62.           IF Row% > (14 - Middle!) AND Row% < (15 + Middle!) THEN Clr = _RGB32(255, 0, 0) ELSE Clr = _RGB32(200, 0, 0)
  63.  
  64.         CASE 2
  65.           IF Row% > (14 - Right!) AND Row% < (15 + Right!) THEN Clr = _RGB32(255, 0, 0) ELSE Clr = _RGB32(200, 0, 0)
  66.  
  67.       END SELECT
  68.  
  69.       DrawLightBar x%, y%, Clr
  70.  
  71.       y% = y% + 12
  72.     NEXT
  73.     x% = x% + 65
  74.   NEXT
  75.  
  76.  
  77.  
  78.  
  79.  
  80. SUB DrawLightBar (x, y, clr) '##############################################
  81.  
  82. w = 50
  83. h = 8
  84.  
  85. CIRCLE (x, y + 4), 4, clr
  86. PAINT STEP(0, 0), clr, clr
  87. CIRCLE (x + 50, y + 4), 4, clr
  88. PAINT STEP(0, 0), clr, clr
  89.  
  90. LINE (x, y)-(x + w, y + h), clr, BF
  91.  
  92.  
  93.  
  94. '/////////
  95.  
  96.  
  97.  
  98. '// Library Declerations
  99. DECLARE LIBRARY "SFML_Audio_Wrapper", "sfml\libsfml-audio"
  100.   SUB Mic_Start (BYVAL SampleRate&)
  101.   SUB Mic_End
  102.   SUB Mic_Play
  103.   SUB Mic_Pause
  104.   SUB Mic_Stop
  105.   SUB Mic_Save (Filename$)
  106.   FUNCTION Mic_Get_SampleCount&
  107.   FUNCTION Mic_Get_Sample% (BYVAL SampleNum&)
  108.   FUNCTION Sound_Load (FileName$)
  109.   FUNCTION Sound_Num_Samples
  110.   FUNCTION Sound_Get_Sample% (BYVAL SampleNum&)
  111.   SUB SNDRAW_Save (RawSnd%, BYVAL NumSamples&, BYVAL SampleRate&, BYVAL Channels&, FileName$)
  112.   FUNCTION Sound_Num_Channels&
  113.  

Requires the attached files to be extracted to your qb64 directory.

Happy coding folks,

Unseen
* SFML_16_Wrapper.zip (Filesize: 7.51 MB, Downloads: 203)