Author Topic: Blackjack  (Read 31528 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #135 on: June 28, 2020, 08:42:04 am »
Had a crazy idea... Scratch has a TTS addon module... The downside is that it does not export. Only plays. I use Audacity as my 'go to' audio editor. Dot get ahead of me.... Programmed Scratch to 'say' - 'Welcome to Blackjack. Take a seat and enter your name." and recorded the sound via my 'camera mic'. Filtered out a little of the background noise... The results could be better, but not too bad, for a cam/mic. What do you think?

Obviously, I will need to run a few more filters through it to 'clean it up', but not too bad for a first try?
* welcome.wav (Filesize: 622.04 KB, Downloads: 143)
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #136 on: June 28, 2020, 10:25:54 am »
Update.

I have managed to figure out how to allow Audacity to record directly from the PC audio. Bingo! No static or need of filtering.

Here is the new sample.

Best part... 'wav' file is 600kb+ and the 'ogg' is just over 30k... Cool
* welcome.ogg (Filesize: 31.53 KB, Downloads: 104)
Logic is the beginning of wisdom.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Blackjack
« Reply #137 on: June 28, 2020, 11:02:47 am »
that sounds really good :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #138 on: June 28, 2020, 11:21:51 am »
that sounds really good :)

+1  Wow! clear and human, it sounds like a winner! I was OK to go with English accent but this can't be any more clear.

So you are getting speech from text with one app and recording that with another and the file size is quite doable.

Good research @johnno56

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #139 on: June 28, 2020, 12:02:56 pm »
It's almost 2am. After I get some sleep, I will extract the individual tracks, pop them into folders, zip them up, them send them... Now to find the alarm clock... and hide it... lol
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #140 on: June 28, 2020, 07:27:41 pm »
Ok. At a more respectable time of almost 9:30am... Here is the revised collection of 'dealer comments'. Check them and make sure that they are ok? Any problems then let me know and I will fix it.

* dealer.zip (Filesize: 924 KB, Downloads: 100)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #141 on: June 28, 2020, 07:48:30 pm »
@johnno56  Just in time!

I just finished my Coalescing Text maker for more modern looking "bubbles" I think.

I am thinking we can play sound and run the Coalescing Text maker and they might finish around the same time?

Check it out:
Code: QB64: [Select]
  1. _TITLE "Coalescing text" 'B+ started 2020-06-23
  2. ' post 2020-06-28  https://www.qb64.org/forum/index.php?topic=1406.msg120007#msg120007
  3. ' using OPTION _EXPLICIT in Blackjack I found a crucial mistake now it coalesces even better!
  4.  
  5. CONST xmax = 1000, ymax = 500
  6.  
  7. DIM SHARED f40 AS LONG 'don't have to be shared
  8. SCREEN _NEWIMAGE(xmax, ymax, 32)
  9. _DELAY .25
  10. f60 = _LOADFONT("OpenSans-ExtraBold.ttf", 60)
  11. f40 = _LOADFONT("OpenSans-ExtraBold.ttf", 36)
  12. COLOR , &HFF880000
  13.  
  14. coalescingText f40, _WIDTH / 2, _HEIGHT / 2, "Testing 1, 2, 3... How much can we fit?"
  15. coalescingText f60, _WIDTH / 2, _HEIGHT / 4, "Bplus did it! Coalescing Text"
  16.  
  17. PRINT "test is done" 'check the font, autodisplay and color restoration
  18.  
  19. 'center the text at x, y  dimension of a white/black background space will depend on font height and width of print string
  20. SUB coalescingText (fh&, xc, yc, text AS STRING)
  21.     'should not change anything on main screen as we will be projecting images to it in empty area
  22.     DIM oldFont&, oldBC~&, oldFC~&, olddisplay, screenshot&, w, h, temp&, yy, xx, p, i, projX, projY, loopI
  23.  
  24.     oldFont& = _FONT '_printwidth(s$, desth&)
  25.     oldBC~& = _BACKGROUNDCOLOR
  26.     oldFC~& = _DEFAULTCOLOR
  27.     olddisplay = _AUTODISPLAY
  28.     screenshot& = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  29.     _PUTIMAGE , 0, screenshot&
  30.     _FONT fh& 'get measures
  31.     w = _PRINTWIDTH(text) + 40 ' create margin 20 around text
  32.     h = _FONTHEIGHT(fh&) + 40
  33.     'PRINT w, h    'exactly right
  34.     temp& = _NEWIMAGE(w, h, 32)
  35.     _DEST temp&
  36.     _FONT fh&
  37.  
  38.     'initializing
  39.     COLOR _RGB32(255, 255, 200), 0
  40.     _PRINTSTRING (20, 20), text
  41.     _SOURCE temp&
  42.     FOR yy = 0 TO h - 1 'simply count particles
  43.         FOR xx = 0 TO w - 1
  44.             IF POINT(xx, yy) <> 0 THEN p = p + 1
  45.         NEXT
  46.     NEXT
  47.     DIM x(p), y(p), dx(p), dy(p)
  48.     FOR yy = 0 TO h - 1
  49.         FOR xx = 0 TO w - 1
  50.             IF POINT(xx, yy) <> 0 THEN
  51.                 i = i + 1
  52.                 x(i) = xx: y(i) = yy: dx(i) = RND * 6 - 3: dy(i) = RND * 6 - 3
  53.             END IF
  54.         NEXT
  55.     NEXT
  56.     projX = xc - .5 * w: projY = yc - .5 * h
  57.     DIM coal(95) AS LONG
  58.     coal(0) = _NEWIMAGE(w, h, 32)
  59.     _PUTIMAGE , temp&, coal(0)
  60.     'draw loop
  61.     FOR loopI = 1 TO 95
  62.         LINE (1, 1)-(w - 2, h - 2), _RGB32(0, 0, 0, 3 * loopI), BF
  63.         LINE (0, 0)-STEP(w - 1, h - 1), _RGB32(255 - 3 * loopI, 255 - 3 * loopI, 200, 3 * loopI), B
  64.         FOR i = 1 TO p
  65.             x(i) = x(i) + dx(i): y(i) = y(i) + dy(i)
  66.             IF x(i) < 1 OR x(i) > w - 3 OR y(i) < 1 OR y(i) > h - 3 THEN x(i) = RND * w - 1: y(i) = RND * h - 1
  67.             LINE (x(i), y(i))-STEP(0, 0), _RGB32(255 - 2 * loopI, 255 - 2 * loopI, 200)
  68.         NEXT
  69.         coal(loopI) = _NEWIMAGE(w, h, 32)
  70.         _PUTIMAGE , temp&, coal(loopI)
  71.     NEXT
  72.     _DEST 0
  73.     FOR i = 95 TO 0 STEP -1
  74.         'LINE (projx, projy)-STEP(w - 1, h - 1), &HFF000000, BF
  75.         _PUTIMAGE , screenshot&, 0
  76.         _PUTIMAGE (projX, projY)-STEP(w - 1, h - 1), coal(i), 0, (0, 0)-STEP(w - 1, h - 1)
  77.         _FREEIMAGE coal(i)
  78.         _DISPLAY
  79.         _LIMIT 30
  80.     NEXT
  81.     'restore
  82.     IF olddisplay THEN _AUTODISPLAY
  83.     _FREEIMAGE temp&
  84.     _FREEIMAGE screenshot&
  85.     _SOURCE 0
  86.     COLOR oldFC~&, oldBC~&
  87.     _FONT oldFont&
  88.  
  89.  
  90.  

EDIT: adding the SUB into Blackjack using OPTION _EXPLICIT found a critical miss, fixed, and now the effect is even better!

« Last Edit: June 28, 2020, 09:23:20 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #142 on: June 28, 2020, 08:11:34 pm »
Well... I now have 'OpenSans-ExtraBold.ttf' installed on my system... lol

I have not seen text 'appear' like that before... Very cool...
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #143 on: June 28, 2020, 08:23:11 pm »
ps: Perhaps a slight mod of the 'limit' on line #79? Perhaps the speed of limit could be calculated from time length of each phrase? ie: The longer the phrase the quicker the 'limit'? I have no idea how to do that... just a rogue thought...
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #144 on: June 28, 2020, 08:30:59 pm »
ps: Perhaps a slight mod of the 'limit' on line #79? Perhaps the speed of limit could be calculated from time length of each phrase? ie: The longer the phrase the quicker the 'limit'? I have no idea how to do that... just a rogue thought...

Great idea Johnno, It could easily be built into the sub from the text length, hopefully I will get a feel for timing from your latest audio's, thanks.

PS the font OpenSans-ExtraBold.ttf is same as used in last version of Blackjack same source as our Neon2.ttf. I really like that fat text!
« Last Edit: June 28, 2020, 08:34:09 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #145 on: June 28, 2020, 09:22:28 pm »
Try Coalescing Code again if you checked it out already (2020-06-28 9:19 PM Ohio Time zone) found miss, fixed, and now the effect is even better!

https://www.qb64.org/forum/index.php?topic=1406.msg120007#msg120007

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #146 on: June 28, 2020, 10:31:18 pm »
Ok. Tried the 'second' version. Actually nicer than the first... Cool.

The font was installed because I had upgraded Linux Mint 18.1 to 19.3 and all my previous 'manually' added fonts migrated to the ether... *sigh*
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #147 on: June 29, 2020, 01:53:46 am »
Progress report: Bets, numbers and busts are installed and working, shaping up nicely with Dealer speaking.

Really good sound quality @johnno56

I am playing the Welcome from the splash screen and we are sort of still in the street, outside the building.

I wonder if the voice would not ask us to sit down but to write the Player name and enter.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Blackjack
« Reply #148 on: June 29, 2020, 05:27:50 am »
Consider it done.

Here is the basic 'Welcome' plus a few extra 'post-entry' responses.
* welcomePlus.zip (Filesize: 130.89 KB, Downloads: 118)
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Blackjack
« Reply #149 on: June 29, 2020, 11:11:03 am »
Thanks @johnno56  for quick return.

It turns out that the audio is faster than the coalescing text and I have to get it started before the audio.

I am wondering if I should even keep coalescing text in. Well I will leave it for now because it's nice signal for Dealer speech. I will fiddle around with it a bit.

As I understand it sound can play and graphics can continue while sound is playing but coalescing monopolizes execution flow until it's finished. Maybe I need to play sound from a timer, let coalescing get started and set timer for .5 sec delay to play sound.